package org.example.base.util;

import lombok.Data;

@Data

public class AjaxResult {
    private String msg;
    private Boolean success;
    private Object data;

    public AjaxResult(){
        this.success=true;

    }
    public static AjaxResult success(){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.msg="操作成功";
        ajaxResult.success=true;
        return ajaxResult;
    }
    public static AjaxResult success(Object obj){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.msg="操作成功";
        ajaxResult.success=true;
        ajaxResult.data=obj;
        return ajaxResult;
    }
    public static AjaxResult error(){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.msg="操作失败";
        ajaxResult.success=false;
        return ajaxResult;
    }
    public static AjaxResult error(String msg){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.msg=msg;
        ajaxResult.success=false;
        return ajaxResult;
    }


}
